package com.leyou.controller;

import com.leyou.pojo.User;
import com.leyou.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.sql.DataSource;

/**
 * @author XiaoLuo
 * @ClassName: HelloController
 * @Description: ${todo}
 * @date 2019/4/5 14:22
 */
@RestController
public class HelloController {
    @Autowired
    public DataSource dataSource;
    @Autowired
    private UserService userService;
    @GetMapping("hello")
    public String hello(){
        return "hello spring boot!"+dataSource;
    }
    @GetMapping("helloMapper/{userId}")
    public User helloMapper(@PathVariable("userId")Long id){
        User user = this.userService.queryById(id);
        return user;
    }
}
